<template>
	<view>
		<u-card padding="16">
			<view class="" slot="head">
				<view class="wrap">
					<u-row>
						<u-col span="10" text-align="left">
							<view class="weikaishi2 lanse">
								<span v-html="'库位：'+dataList2.positionNumber"></span>
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="6">
							<view class="weikaishi4 u-m-t-4">
								<span v-html="'库存数：'+dataList2.num"></span>
							</view>
						</u-col>
						<u-col span="6">
							<view class="weikaishi4 u-m-t-4">
								<span v-html="'库存体积：'+dataList2.volume"></span>
							</view>
						</u-col>
						<u-col span="6">
							<view class="weikaishi4 u-m-t-4">
								<span v-html="'盘点数：'+dataList2.trueNum"></span>
							</view>
						</u-col>
						<u-col span="6">
							<view class="weikaishi4 u-m-t-4">
								<span v-html="'盘点体积：'+dataList2.trueVolume"></span>
							</view>
						</u-col>
						<u-col span="6">
							<view class="weikaishi4 u-m-t-4">
								<span v-html="'托数：'+dataList2.trayNum"></span>
							</view>
						</u-col>
						<u-col span="6">
							<view class="weikaishi4 u-m-t-4">
								<span v-html="'品类：'+dataList2.goodsNum"></span>
							</view>
						</u-col>
					</u-row>
				</view>
			</view>
		</u-card>
		
		<u-card padding="16" v-for="(item,index) in dataList2.list" :key="index">
			<view class="" slot="head">
				<view class="wrap">
					<u-row>
						<u-col span="12" text-align="left">
							<view class="weikaishi4">
								<span>名称：{{item.goodsName}}</span>
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="7">
							<view class="weikaishi6 u-line-1">
								<span>编号：{{item.goodsNumber}}</span>
							</view>
						</u-col>
						<u-col span="5">
							<view class="weikaishi6 u-line-1">
								<span>货号：{{item.goodsNo}}</span>
							</view>
						</u-col>
						<u-col span="7">
							<view class="weikaishi6 u-line-1">
								<span>库存：{{item.num}}件*{{item.trayNum}}托</span>
							</view>
						</u-col>
						<u-col span="5">
							<view class="weikaishi6 u-line-1">
								<span>盘点：{{item.trueNum}}件</span>
							</view>
						</u-col>
						<u-col span="7">
							<view class="weikaishi6 u-line-1">
								<span>单位：{{item.goodsUnit}}</span>
							</view>
						</u-col>
						<u-col span="5">
							<view class="weikaishi6 u-line-1">
								<span>包装：{{item.goodsPacking}}</span>
							</view>
						</u-col>
						<u-col span="7">
							<view class="weikaishi6 u-line-1">
								<span>规格：{{item.goodsSpecs}}</span>
							</view>
						</u-col>
						<u-col span="12" text-align="left" v-if="item.xianggui">
							<view class="weikaishi6">
								<span>
								换算：{{parseInt(item.num/item.xianggui)}}箱{{item.num-parseInt(item.num/item.xianggui)*item.xianggui}}盒
								</span>
							</view>
						</u-col>
					</u-row>
				</view>
			</view>
			<view class="" slot="body">
				<view class="wrap">
					<u-collapse>
						<u-collapse-item title="详情">
							<u-row v-for="(item1,index1) in item.list2" :key="index1">
								<u-col span="12">
									<view class="u-line-1 u-m-t-10 weikaishi6">
										<span>状态：{{item1.inventory}}</span>
									</view>
								</u-col>
								<u-col span="5">
									<view class="u-line-1 u-m-t-4 weikaishi6">
										<span>托盘：{{item1.trayNumber}}</span>
									</view>
								</u-col>
								<u-col span="7">
									<view class="u-line-1 u-m-t-4 weikaishi6">
										<span>类型：{{item1.panType}}</span>
									</view>
								</u-col>
								<u-col span="5">
									<view class="u-line-1 u-m-t-4 weikaishi6">
										<span>库存数：{{item1.num}}</span>
									</view>
								</u-col>
								<u-col span="7">
									<view class="u-line-1 u-m-t-4 weikaishi6">
										<span>盘点数：{{item1.trueNum}}</span>
									</view>
								</u-col>
								<u-col span="12" text-align="left" v-if="item1.xianggui">
									<view class="weikaishi6">
										<span>
										换算：{{parseInt(item1.num/item1.xianggui)}}箱{{item1.num-parseInt(item1.num/item1.xianggui)*item1.xianggui}}盒
										</span>
									</view>
								</u-col>
								<u-col span="6">
									<view class="u-line-1 u-m-t-4 weikaishi6">
										<span>批次：{{item1.goodsbatchs}}</span>
									</view>
								</u-col>
								<u-col span="6">
									<view class="u-line-1 u-m-t-4 weikaishi6">
										<span>盘点：{{item1.newGoodsbatchs}}</span>
									</view>
								</u-col>
								<u-col span="12">
									<view class="u-m-t-4 weikaishi6">
										<span>描述：{{item1.nodes}}</span>
									</view>
								</u-col>
							</u-row>
						</u-collapse-item>
					</u-collapse>
				</view>
			</view>
		</u-card>
		<view>
			<u-toast ref="uToast" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList2:{},
				diskId:'',
				positionId:'',
				createUser:''
			};
		},
		onLoad(open) {
			this.diskId = open.diskId
			this.positionId = open.positionId
			this.createUser = open.createUser
		},
		onShow() {
			setTimeout(() => {
				this.refresh()
			}, 200)
		},
		onPullDownRefresh() {
			this.refresh()
			uni.stopPullDownRefresh()
		},
		methods: {
			refresh(){
				uni.showLoading({
					title: '加载中'
				})
				this.$http.post('/rest/PanDian/yipositionlist_query',{
				},{
					params: {
						diskId: this.diskId,
						positionId: this.positionId,
						createUser: this.createUser
					},
					header: {
						'Authorization' :uni.getStorageSync('token'),
					}
				}).then(res => {
					this.dataList2 = res.data.data
				})
				uni.hideLoading()
			},
		}
	};
</script>
<style lang="scss">
	
	.u-body-item {
		padding: 20rpx 15rpx;
	}
	.wrap {
		padding: 10rpx;
	}

	.u-row {
		margin: 10rpx 2rpx;
	}
</style>